home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / expect / lib_debug.c < prev    next >
C/C++ Source or Header  |  1993-03-15  |  974b  |  45 lines

  1. /* lib_debug.c - debug function for the expect C library, libexpect.a
  2.  
  3. Written by: Don Libes, libes@cme.nist.gov, NIST, 12/3/90
  4.  
  5. Design and implementation of this program was paid for by U.S. tax
  6. dollars.  Therefore it is public domain.  However, the author and NIST
  7. would appreciate credit if this program or parts of it are used.
  8. */
  9.  
  10. #include "exp_conf.h"
  11. #include <stdio.h>
  12. #include <varargs.h>
  13. #include "exp_rename.h"
  14.  
  15. #ifndef TRUE
  16. #define TRUE 1
  17. #define FALSE 0
  18. #endif
  19.  
  20. int is_debugging = FALSE;
  21. FILE *debugfile = 0;
  22. FILE *logfile = 0;
  23.  
  24. /* send to log if open and debugging enabled */
  25. /* send to stderr if debugging enabled */
  26. /* use this function for recording unusual things in the log */
  27. /*VARARGS*/
  28. void
  29. debuglog(va_alist)
  30. va_dcl
  31. {
  32.     char *fmt;
  33.     va_list args;
  34.  
  35.     va_start(args);
  36.     fmt = va_arg(args,char *);
  37.     if (debugfile) vfprintf(debugfile,fmt,args);
  38.     if (is_debugging) {
  39.         vfprintf(stderr,fmt,args);
  40.         if (logfile) vfprintf(logfile,fmt,args);
  41.     }
  42.     va_end(args);
  43. }
  44.  
  45.